<div class="well">
    <a class="btn btn-primary" href="http://www.mediafire.com/#c5ggedjvdzecw" target="_blank">Книги</a>
    <button type="button" class="btn btn-success" onclick="study.addTerm();">Добавить
        <i class="icon-plus-sign"></i>
    </button>
    <h4>Алфавитный указатель</h4>
    <div class="study-letters">
        <? foreach ($this->letters as $letter):?>
            <a class="btn letter" href="<?= $this->url(array('letter' => $letter['first_symbol'])); ?>"><?= mb_convert_case($letter['first_symbol'], MB_CASE_LOWER, "UTF-8");?>
                <span class="badge badge-warning"><?= $letter['count_terms'] ?></span>
            </a>
        <? endforeach;?>
    </div>
</div>
<hr>
<? if ($this->searchText):?>
<div  class="alert alert-success">
    <span><?= $this->searchText ?></span>
</div>
<? endif; ?>
<div class="terms-block">
    <? foreach ($this->terms as $term):?>
    <?/**@var $term Application_Model_Term */?>

        <div class="well term" id="term-id-<?=$term->getTermId()?>">
            <div class="post-action">
                <i title="Добавить в текущие" class="icon-check" onclick="study.setAction(<?=$term->getTermId()?>, 1)"></i>
                <i title="Редактировать" class="icon-pencil" onclick="study.editTerm(<?=$term->getTermId()?>)"></i>
                <i title="Удалить" class="icon-trash" onclick="study.deleteTerm(<?=$term->getTermId()?>);"></i>
            </div>
            <h6><?= $term->getTermName(); ?></h6>
            <p><?= $term->getTermInfo(); ?></p>
            <hr>
            <div class="term-tag">
                <h6><i class="icon-tags"></i>Теги:</h6>
                <? if ($term->getTags()):?>
                    <? foreach($term->getTags() as $tag):?>
                        <?/** @var $tag Application_Model_Tag */?>
                        <span class="label">
                            <a class="label" href="/study/?tag=<?=$tag->getTagId()?>"><?= $tag->getTagName();?></a>
                            <i title="Удалить" class="icon-trash" onclick="study.deleteTag(<?=$tag->getTagId()?>, <?=$term->getTermId()?>, this)"></i>
                        </span>
                    <? endforeach; ?>
                <? endif; ?>
                <span class="form-tag">
                    <a onclick="study.showFormNewTag(this)" data-term="<?=$term->getTermId() ?>" class="label label-info">Добавить</a>
                </span>
           </div>
        </div>
    <? endforeach; ?>
</div>
<?= $this->paginationControl($this->paginator, 'Sliding','study/pagination_terms.phtml'); ?>